﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;

namespace Nivdal
{
    public partial class TranslateMaster : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GetNivdalData.GetNivdalData GND = new GetNivdalData.GetNivdalData();
            OnlineUser ou = (OnlineUser)Session["User"];
            if (ou.UserAccessLevel == "1" || ou.UserAccessLevel == "0")
            {
                Response.Redirect("~/GeneralMessage.aspx?MessageString=" + ou.UserAccessLevel);
            }
            
            if (ou.TeamId == "Null")
                Response.Redirect("~/GeneralMessage.aspx?MessageString=274ggdizz5!lk");

            string Language = GND.ReadNivdalIntData("UserId", "Nivdal_GetUserTranslateLanguage", ou.UserId);
            if ((Language == null) || (Language == "0"))
                Response.Redirect("GeneralMessage.aspx?MessageString=k882m299nnqmhtsd");
            else if (Language == "2")
                Response.Redirect("TranslateEnglish.aspx");
            else
            {
                if (!IsPostBack)
                {
                    TranslationStatusDataSourse.SelectParameters.Add("Language", Language);
                }
            }
        }

        protected override void InitializeCulture()
        {
            OnlineUser ou = (OnlineUser)Session["User"];
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(ou.UICulture);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ou.Culture);
        }
    }
}